#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <pjsua2.hpp>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include "config.h"
#include "ui_mainwindow.h"
#include "print_info.h"
#include "log.h"

using namespace pj;
using namespace std;
//#include <X11/Xlib.h>
//#include <X11/Xutil.h>
//#include <QX11Info>

#include "my_account.h"
#include "my_call.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    Endpoint *ep;
    My_account *acc;
    TransportId defaultTransportId;
    print_info *printInfoClass;
    Log* myLog;

    AudioMediaPlayer player;

    int TransPort;
    QString selfURL;
    QString destURL;
    string  usrName;

private:
    void FunctionDemo1(void);

    void CleanUIAnswer(void);

    MyCall** CheckHaveCallIsActiveAndBackPtr(void);

    void CleanUITakingCall(void);

    bool CheckAccIsExist(void);

private slots:
    void PJSUA2_Init(void);

    void MainWindowUiInit(void);

//    void printOnInstantMessage(OnInstantMessageParam *prm);

    void IncomingCallSolt(OnIncomingCallParam* iprm);

    void OnCallStateOverSolt(void);

    void OnCallMediaStateSolt(void);

    void OnInstantMessageSolt(OnInstantMessageParam* prm);

    void on_pushButton_createAccount_clicked();

    void on_pushButton_call_clicked();

    void on_pushButton_changePort_clicked();

    void on_pushButton_config1_clicked();

    void on_pushButton_config2_clicked();

    void on_pushButton_close_clicked();

    void on_pushButton_hanup_clicked();

    void on_pushButton_shutDown_clicked();

    void on_pushButton_hold_clicked();

    void on_pushButton_configWin_clicked();

    void on_pushButton_sendMsg_clicked();

    void on_pushButton_answer_clicked();

    void on_pushButton_playWav_clicked();

    void on_pushButton_stopWav_clicked();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
